package com.example.demoa;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    private Button btnStartB;
    private final String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.e(TAG,"onCreate");

       //btnStartB点击事件
        btnStartB = findViewById(R.id.btn_start_b);
        btnStartB.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this,ActivityB.class);
                startActivity(intent);
            }
        });
    }
//创建
    @Override
    protected void onStart(){
        super.onStart();
        Log.e(TAG,"onStart");
    }
    //启动，不可交互
    @Override
    protected void onRestart() {
        super.onRestart();
        Log.e(TAG,"onRestart");
    }
    //恢复：可见，可交互
    @Override
    protected void onResume() {
        super.onResume();
        Log.e(TAG,"onResume");
    }
    //暂停：可见，不可交互
    @Override
    protected void onPause() {
        super.onPause();
        Log.e(TAG,"onPause");
    }
    //不可见，不可交互
    @Override
    protected void onStop() {
        super.onStop();
        Log.e(TAG,"onStop");
    }
    //销毁
    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.e(TAG,"onDestroy");
    }
}
